<?php


abstract class BaseHistoricoAcademico extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $cp_historico_academico;


	
	protected $cf_lapso;


	
	protected $cf_estudiante;


	
	protected $materias_cursadas;


	
	protected $materias_aprobadas;


	
	protected $materias_aplazadas;


	
	protected $materias_condicion_cero;


	
	protected $materias_condicion_uno;


	
	protected $materias_condicion_dos;


	
	protected $semestre;


	
	protected $estatus;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getCpHistoricoAcademico()
	{

		return $this->cp_historico_academico;
	}

	
	public function getCfLapso()
	{

		return $this->cf_lapso;
	}

	
	public function getCfEstudiante()
	{

		return $this->cf_estudiante;
	}

	
	public function getMateriasCursadas()
	{

		return $this->materias_cursadas;
	}

	
	public function getMateriasAprobadas()
	{

		return $this->materias_aprobadas;
	}

	
	public function getMateriasAplazadas()
	{

		return $this->materias_aplazadas;
	}

	
	public function getMateriasCondicionCero()
	{

		return $this->materias_condicion_cero;
	}

	
	public function getMateriasCondicionUno()
	{

		return $this->materias_condicion_uno;
	}

	
	public function getMateriasCondicionDos()
	{

		return $this->materias_condicion_dos;
	}

	
	public function getSemestre()
	{

		return $this->semestre;
	}

	
	public function getEstatus()
	{

		return $this->estatus;
	}

	
	public function setCpHistoricoAcademico($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cp_historico_academico !== $v) {
			$this->cp_historico_academico = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::CP_HISTORICO_ACADEMICO;
		}

	} 
	
	public function setCfLapso($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cf_lapso !== $v) {
			$this->cf_lapso = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::CF_LAPSO;
		}

	} 
	
	public function setCfEstudiante($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cf_estudiante !== $v) {
			$this->cf_estudiante = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::CF_ESTUDIANTE;
		}

	} 
	
	public function setMateriasCursadas($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_cursadas !== $v) {
			$this->materias_cursadas = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_CURSADAS;
		}

	} 
	
	public function setMateriasAprobadas($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_aprobadas !== $v) {
			$this->materias_aprobadas = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_APROBADAS;
		}

	} 
	
	public function setMateriasAplazadas($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_aplazadas !== $v) {
			$this->materias_aplazadas = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_APLAZADAS;
		}

	} 
	
	public function setMateriasCondicionCero($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_condicion_cero !== $v) {
			$this->materias_condicion_cero = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_CONDICION_CERO;
		}

	} 
	
	public function setMateriasCondicionUno($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_condicion_uno !== $v) {
			$this->materias_condicion_uno = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_CONDICION_UNO;
		}

	} 
	
	public function setMateriasCondicionDos($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->materias_condicion_dos !== $v) {
			$this->materias_condicion_dos = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::MATERIAS_CONDICION_DOS;
		}

	} 
	
	public function setSemestre($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->semestre !== $v) {
			$this->semestre = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::SEMESTRE;
		}

	} 
	
	public function setEstatus($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->estatus !== $v) {
			$this->estatus = $v;
			$this->modifiedColumns[] = HistoricoAcademicoPeer::ESTATUS;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->cp_historico_academico = $rs->getString($startcol + 0);

			$this->cf_lapso = $rs->getString($startcol + 1);

			$this->cf_estudiante = $rs->getString($startcol + 2);

			$this->materias_cursadas = $rs->getInt($startcol + 3);

			$this->materias_aprobadas = $rs->getInt($startcol + 4);

			$this->materias_aplazadas = $rs->getInt($startcol + 5);

			$this->materias_condicion_cero = $rs->getInt($startcol + 6);

			$this->materias_condicion_uno = $rs->getInt($startcol + 7);

			$this->materias_condicion_dos = $rs->getInt($startcol + 8);

			$this->semestre = $rs->getString($startcol + 9);

			$this->estatus = $rs->getString($startcol + 10);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 11; 
		} catch (Exception $e) {
			throw new PropelException("Error populating HistoricoAcademico object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(HistoricoAcademicoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			HistoricoAcademicoPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(HistoricoAcademicoPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = HistoricoAcademicoPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setCpHistoricoAcademico($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += HistoricoAcademicoPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = HistoricoAcademicoPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = HistoricoAcademicoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getCpHistoricoAcademico();
				break;
			case 1:
				return $this->getCfLapso();
				break;
			case 2:
				return $this->getCfEstudiante();
				break;
			case 3:
				return $this->getMateriasCursadas();
				break;
			case 4:
				return $this->getMateriasAprobadas();
				break;
			case 5:
				return $this->getMateriasAplazadas();
				break;
			case 6:
				return $this->getMateriasCondicionCero();
				break;
			case 7:
				return $this->getMateriasCondicionUno();
				break;
			case 8:
				return $this->getMateriasCondicionDos();
				break;
			case 9:
				return $this->getSemestre();
				break;
			case 10:
				return $this->getEstatus();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = HistoricoAcademicoPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getCpHistoricoAcademico(),
			$keys[1] => $this->getCfLapso(),
			$keys[2] => $this->getCfEstudiante(),
			$keys[3] => $this->getMateriasCursadas(),
			$keys[4] => $this->getMateriasAprobadas(),
			$keys[5] => $this->getMateriasAplazadas(),
			$keys[6] => $this->getMateriasCondicionCero(),
			$keys[7] => $this->getMateriasCondicionUno(),
			$keys[8] => $this->getMateriasCondicionDos(),
			$keys[9] => $this->getSemestre(),
			$keys[10] => $this->getEstatus(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = HistoricoAcademicoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setCpHistoricoAcademico($value);
				break;
			case 1:
				$this->setCfLapso($value);
				break;
			case 2:
				$this->setCfEstudiante($value);
				break;
			case 3:
				$this->setMateriasCursadas($value);
				break;
			case 4:
				$this->setMateriasAprobadas($value);
				break;
			case 5:
				$this->setMateriasAplazadas($value);
				break;
			case 6:
				$this->setMateriasCondicionCero($value);
				break;
			case 7:
				$this->setMateriasCondicionUno($value);
				break;
			case 8:
				$this->setMateriasCondicionDos($value);
				break;
			case 9:
				$this->setSemestre($value);
				break;
			case 10:
				$this->setEstatus($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = HistoricoAcademicoPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setCpHistoricoAcademico($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setCfLapso($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setCfEstudiante($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setMateriasCursadas($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setMateriasAprobadas($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setMateriasAplazadas($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setMateriasCondicionCero($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setMateriasCondicionUno($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setMateriasCondicionDos($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setSemestre($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setEstatus($arr[$keys[10]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(HistoricoAcademicoPeer::DATABASE_NAME);

		if ($this->isColumnModified(HistoricoAcademicoPeer::CP_HISTORICO_ACADEMICO)) $criteria->add(HistoricoAcademicoPeer::CP_HISTORICO_ACADEMICO, $this->cp_historico_academico);
		if ($this->isColumnModified(HistoricoAcademicoPeer::CF_LAPSO)) $criteria->add(HistoricoAcademicoPeer::CF_LAPSO, $this->cf_lapso);
		if ($this->isColumnModified(HistoricoAcademicoPeer::CF_ESTUDIANTE)) $criteria->add(HistoricoAcademicoPeer::CF_ESTUDIANTE, $this->cf_estudiante);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_CURSADAS)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_CURSADAS, $this->materias_cursadas);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_APROBADAS)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_APROBADAS, $this->materias_aprobadas);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_APLAZADAS)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_APLAZADAS, $this->materias_aplazadas);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_CONDICION_CERO)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_CONDICION_CERO, $this->materias_condicion_cero);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_CONDICION_UNO)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_CONDICION_UNO, $this->materias_condicion_uno);
		if ($this->isColumnModified(HistoricoAcademicoPeer::MATERIAS_CONDICION_DOS)) $criteria->add(HistoricoAcademicoPeer::MATERIAS_CONDICION_DOS, $this->materias_condicion_dos);
		if ($this->isColumnModified(HistoricoAcademicoPeer::SEMESTRE)) $criteria->add(HistoricoAcademicoPeer::SEMESTRE, $this->semestre);
		if ($this->isColumnModified(HistoricoAcademicoPeer::ESTATUS)) $criteria->add(HistoricoAcademicoPeer::ESTATUS, $this->estatus);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(HistoricoAcademicoPeer::DATABASE_NAME);

		$criteria->add(HistoricoAcademicoPeer::CP_HISTORICO_ACADEMICO, $this->cp_historico_academico);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getCpHistoricoAcademico();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setCpHistoricoAcademico($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setCfLapso($this->cf_lapso);

		$copyObj->setCfEstudiante($this->cf_estudiante);

		$copyObj->setMateriasCursadas($this->materias_cursadas);

		$copyObj->setMateriasAprobadas($this->materias_aprobadas);

		$copyObj->setMateriasAplazadas($this->materias_aplazadas);

		$copyObj->setMateriasCondicionCero($this->materias_condicion_cero);

		$copyObj->setMateriasCondicionUno($this->materias_condicion_uno);

		$copyObj->setMateriasCondicionDos($this->materias_condicion_dos);

		$copyObj->setSemestre($this->semestre);

		$copyObj->setEstatus($this->estatus);


		$copyObj->setNew(true);

		$copyObj->setCpHistoricoAcademico(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new HistoricoAcademicoPeer();
		}
		return self::$peer;
	}

} 